<template>
  <div>
    <el-row :gutter="10">
      <el-form ref="salesmanForm" :model="salesmanFormData" :rules="rules" size="mini" label-width="100px"
        label-position="top">
        <el-col :span="12">
          <el-form-item label="销售员ID" prop="salesmanId">
            <el-input v-model="salesmanFormData.salesmanId" placeholder="请输入销售员ID" readonly :disabled='true'
              prefix-icon='el-icon-user-solid' :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="销售员姓名" prop="salesmanName">
            <el-input v-model="salesmanFormData.salesmanName" placeholder="请输入销售员姓名" :maxlength="10"
              show-word-limit readonly :disabled='true' clearable prefix-icon='el-icon-user'
              :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="销售员性别" prop="salesmanSex">
            <el-select v-model="salesmanFormData.salesmanSex" placeholder="请选择销售员性别" :disabled='true'
              :style="{width: '100%'}">
              <el-option v-for="(item, index) in salesmanSexOptions" :key="index" :label="item.label"
                :value="item.value" :disabled="item.disabled"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="联系方式" prop="salesmanPhone">
            <el-input v-model="salesmanFormData.salesmanPhone" placeholder="请输入联系方式" :maxlength="11"
              show-word-limit readonly :disabled='true' clearable prefix-icon='el-icon-mobile-phone'
              :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="地址" prop="salesmanAddress">
            <el-input v-model="salesmanFormData.salesmanAddress" placeholder="请输入地址" :maxlength="50"
              show-word-limit readonly :disabled='true' clearable prefix-icon='el-icon-add-location'
              :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item size="large">
            <!-- <el-button type="primary" @click="submitForm">提交</el-button>
            <el-button @click="resetForm">重置</el-button> -->
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>
  </div>
</template>
<script>
export default {
  components: {},
  props: ['salesmanForm'],
  data() {
    return {
      salesmanFormData: {
        salesmanId: undefined,
        salesmanName: undefined,
        salesmanSex: 0,
        salesmanPhone: undefined,
        salesmanAddress: undefined,
      },
      rules: {
        salesmanId: [{
          required: true,
          message: '请输入销售员ID',
          trigger: 'blur'
        }],
        salesmanName: [{
          required: true,
          message: '请输入销售员姓名',
          trigger: 'blur'
        }],
        salesmanSex: [{
          required: true,
          message: '请选择销售员性别',
          trigger: 'change'
        }],
        salesmanPhone: [{
          required: true,
          message: '请输入联系方式',
          trigger: 'blur'
        }],
        salesmanAddress: [{
          required: true,
          message: '请输入地址',
          trigger: 'blur'
        }],
      },
      salesmanSexOptions: [{
        "label": "男",
        "value": 0
      }, {
        "label": "女",
        "value": 1
      }],
    }
  },
  computed: {},
  watch: {},
  created() {
    this.salesmanFormData = this.salesmanForm
  },
  mounted() {},
  methods: {
    submitForm() {
      this.$refs['salesmanForm'].validate(valid => {
        if (!valid) return
        // TODO 提交表单
      })
    },
    resetForm() {
      this.$refs['salesmanForm'].resetFields()
    },
  }
}

</script>
<style>
</style>
